import main from "./openfaas_js/main.js"
import Todo from "./openfaas_js/utils/todo.js";
import GLOBAL from "./openfaas_js/GLOBAL.js";

const {AUTH_riscv64, AUTH_x86, AUTH_x86swarm} = GLOBAL

const URL_PREFIX_riscv64 = `http://admin:${AUTH_riscv64.PASSWORD}@${AUTH_riscv64.HOST}/`
const URL_PREFIX_x86 = `http://admin:${AUTH_x86.PASSWORD}@${AUTH_x86.HOST}/`
const URL_PREFIX_x86swarm = `http://admin:${AUTH_x86swarm.PASSWORD}@${AUTH_x86swarm.HOST}/`

async function syncExecute() {
    await Todo.showTodoList()
    // TankLab: 192.168.1.189
    try {
        let funcName_noPrefix = "python3-strlen"
        let loopCount = 10000
        // riscv64 192.168.10.2
        console.log("# RISC-V OpenFaaS faas-swarm")
        console.log("URL_PREFIX:", URL_PREFIX_riscv64, "\n-------")
        await main.getAllFunctions(URL_PREFIX_riscv64);
        // -------
        // x86 10.30.245.207
        console.log("# X86 OpenFaaS faas-netes")
        console.log("URL_PREFIX:", URL_PREFIX_x86, "\n-------")
        await main.getAllFunctions(URL_PREFIX_x86);
        // -------
        // x86swarm 10.30.245.163
        console.log("# X86 OpenFaaS faas-swarm")
        console.log("URL_PREFIX:", URL_PREFIX_x86swarm, "\n-------")
        await main.getAllFunctions(URL_PREFIX_x86swarm);
    } catch (error) {
        console.error("An error occurred:", error);
    }
}

syncExecute().then(r => {
})

